home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / host.h,v < prev    next >
Encoding:
Text File  |  1992-06-08  |  11.0 KB  |  464 lines

  1. head     1.9;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.6.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.9
  10. date     92.06.05.12.36.11;  author voelker;  state Exp;
  11. branches ;
  12. next     1.8;
  13.  
  14. 1.8
  15. date     92.03.26.20.15.47;  author voelker;  state Exp;
  16. branches ;
  17. next     1.7;
  18.  
  19. 1.7
  20. date     92.03.08.22.43.02;  author voelker;  state Exp;
  21. branches ;
  22. next     1.6;
  23.  
  24. 1.6
  25. date     90.11.06.16.51.15;  author jhh;  state Exp;
  26. branches 1.6.1.1;
  27. next     1.5;
  28.  
  29. 1.5
  30. date     89.06.23.11.30.42;  author rab;  state Exp;
  31. branches ;
  32. next     1.4;
  33.  
  34. 1.4
  35. date     89.06.05.14.27.31;  author mendel;  state Exp;
  36. branches ;
  37. next     1.3;
  38.  
  39. 1.3
  40. date     89.06.05.14.22.22;  author mendel;  state Exp;
  41. branches ;
  42. next     1.2;
  43.  
  44. 1.2
  45. date     88.07.02.16.41.25;  author ouster;  state Exp;
  46. branches ;
  47. next     1.1;
  48.  
  49. 1.1
  50. date     88.06.29.14.51.42;  author ouster;  state Exp;
  51. branches ;
  52. next     ;
  53.  
  54. 1.6.1.1
  55. date     92.06.07.20.36.16;  author kupfer;  state Exp;
  56. branches ;
  57. next     ;
  58.  
  59.  
  60. desc
  61. @@
  62.  
  63.  
  64. 1.9
  65. log
  66. @new host library
  67. @
  68. text
  69. @/*
  70.  * host.h --
  71.  *    Header file for users of the Host_ functions. These functions
  72.  *    access a database of all Sprite hosts on the local network, giving
  73.  *    various information about the host that is needed to communicate
  74.  *    with it in various ways...
  75.  *
  76.  * Copyright (c) 1987 by the Regents of the University of California
  77.  * Permission to use, copy, modify, and distribute this
  78.  * software and its documentation for any purpose and without
  79.  * fee is hereby granted, provided that the above copyright
  80.  * notice appear in all copies.  The University of California
  81.  * makes no representations about the suitability of this
  82.  * software for any purpose.  It is provided "as is" without
  83.  * express or implied warranty.
  84.  *
  85.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.8 92/03/26 20:15:47 voelker Exp Locker: voelker $ SPRITE (Berkeley)"
  86.  */
  87.  
  88. #ifndef _HOST
  89. #define _HOST
  90.  
  91. #ifndef _TYPES
  92. #include <sys/types.h>
  93. #endif
  94. #ifndef _IN
  95. #include <netinet/in.h>
  96. #endif
  97.  
  98. #include <sys/stat.h>
  99. #include <net.h>
  100.  
  101. /*
  102.  * A host information file contains two types of lines.  The
  103.  * first type of line describes a Sprite host:
  104.  *
  105.  *        <spriteID> <machType> <fullname> <aliases>
  106.  *
  107.  * The second type of line describes the types of networks that
  108.  * the host is connected to:
  109.  *
  110.  *        <netType> <netAddr> <inetAddr> 
  111.  *
  112.  * The fields are as follows:
  113.  *
  114.  *    spriteID        The Sprite ID for the host (small number)
  115.  *    machType        The machine type.  This string value is used
  116.  *                when expanding $MACHINE in pathnames.
  117.  *    fullname        The official name for the machine.
  118.  *    aliases              Other names for the machine.
  119.  *
  120.  *    netType         Type of local network by which the machine is
  121.  *                      connected.  Currently, only `ether', `ultra',
  122.  *                      and `fddi' are understood.
  123.  *    netAddr              Address for the local network of the given type.
  124.  *    inetAddr          The internet address of the network interface
  125.  *                          of the host.
  126.  *
  127.  * Each network interface has a given Internet address, so the Internet
  128.  * address can uniquely identify a specific network interface.  But,
  129.  * a host may have multiple network interfaces, so an Internet address
  130.  * does not uniquely identify a host.
  131.  *
  132.  * After each line that defines a Sprite host follow the lines describing
  133.  * the networks that the host is connected to.
  134.  *
  135.  */
  136.  
  137. /*
  138.  * Should be the same as NET_MAX_INTERFACES in netTypes.h
  139.  */
  140. #define HOST_MAX_INTERFACES         3
  141.  
  142. /*
  143.  * A Host_NetInt structure defines the internet and network addresses
  144.  * for a network interface on a host. 
  145.  */
  146. typedef struct Host_NetInt {
  147.     Net_InetAddress     inetAddr;   /* Internet Address */
  148.     Net_Address         netAddr;    /* Address of network interface */
  149. } Host_NetInt;
  150.  
  151. /*
  152.  * A Host_Entry structure contains the name, etc., of a host, plus
  153.  * the addresses of its network interfaces.  Empty interfaces are
  154.  * denoted by having nets[].netAddr.type set to NET_ADDRESS_NONE.
  155.  */
  156. typedef struct {
  157.     char              *name;      /* Primary name */
  158.     char              **aliases;  /* Other names */
  159.     int                  id;        /* Sprite ID */
  160.    char            *machType;  /* Machine type, i.e "sun3", "spur" */
  161.    int            numNets;    /* Number of network interfaces. */
  162.    Host_NetInt          nets[HOST_MAX_INTERFACES];
  163.                                     /* Internet and physical address for
  164.                      * each possible network interface */
  165. } Host_Entry;
  166.  
  167. /*
  168.  * Accessor functions
  169.  */
  170. Host_Entry *    Host_ByID();        /* Find host entry by Sprite ID */
  171. Host_Entry *    Host_ByInetAddr();    /* Find by Internet address */
  172. Host_Entry *    Host_ByName();        /* Find entry by name */
  173. Host_Entry *    Host_ByNetAddr();    /* Find by LAN address */
  174. void        Host_End();        /* Close host description file */
  175. Host_Entry *    Host_Next();        /* Retrieve next entry in file */
  176. int        Host_SetFile();        /* Change file to read for info */
  177. int        Host_Start();        /* Open host description file */
  178.  
  179. #endif /* _HOST */
  180. @
  181.  
  182.  
  183. 1.8
  184. log
  185. @updated to use the Net module structures and library
  186. @
  187. text
  188. @d17 1
  189. a17 1
  190.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.7 92/03/08 22:43:02 voelker Exp Locker: voelker $ SPRITE (Berkeley)"
  191. a30 3
  192.  
  193. #ifdef NEW_HOST
  194.  
  195. d49 2
  196. a50 2
  197.  *    name              The official name for the machine
  198.  *    aliases              Other names for the machine
  199. a51 2
  200.  *    inetAddr          The internet address of the network interface
  201.  *                          of the host.
  202. d56 2
  203. d64 1
  204. a64 1
  205.  * After each line that defines a Sprite host follows the lines describing
  206. a69 18
  207.  * A Host_Entry contains the broken out fields of the host table line
  208.  * for a host.
  209.  *
  210.  * Sprite hosts may be connected to the network by different local-area-nets
  211.  * (LANs). The netType field of the Host_Entry tells what type of network
  212.  * it is. The Addr field in the netAddr union should be chosen based on
  213.  * this type.
  214.  *
  215.  */
  216. typedef enum {
  217.     HOST_ETHER,
  218. /*    HOST_INET   <--- is it deadly to remove this? */
  219.     HOST_ULTRA,
  220.     HOST_FDDI,
  221.     HOST_NONE
  222. } Host_NetType;
  223.  
  224. /*
  225. d75 2
  226. a76 8
  227.  * This should go into net.h when we can get a lock on it.
  228.  */
  229. #ifndef NET_ADDRESS_NONE
  230. #define NET_ADDRESS_NONE            0
  231. #endif
  232.  
  233. /*
  234.  * Should get these from the net include files.
  235. a77 4
  236. #define HOST_ETHER_ADDRESS_SIZE     6
  237. #define HOST_ULTRA_ADDRESS_SIZE     8 /* ? */
  238. #define HOST_FDDI_ADDRESS_SIZE      6
  239.  
  240. d83 5
  241. a91 9
  242. /* remove */
  243.     struct in_addr    inetAddr;   /* Internet address */
  244.     Host_NetType      netType;    /* Network used to connect to host */
  245.     union {
  246.     unsigned char    etherAddr[HOST_ETHER_ADDRESS_SIZE];
  247.                     /* Ethernet address of machine or 
  248.                      * first gateway if netType is HOST_INET. */
  249.     }                  netAddr;    /* Address for that network */
  250. /* end remove */
  251. d93 1
  252. a109 65
  253.  
  254. #else /* NEW_HOST */
  255.  
  256. /*
  257.  * A host information file contains lines of the following form:
  258.  *
  259.  * <spriteID> <netType> <netAddr> <inetAddr> <machType> <name> <aliases>
  260.  *
  261.  * Where the fields are as follows:
  262.  *    spriteID        The Sprite ID for the host (small number)
  263.  *    netType         Type of local network by which the machine is
  264.  *                      connected. Currently, only "ether" and "inet" 
  265.  *                      are understood.
  266.  *    netAddr              Address for the local network
  267.  *    inetAddr          The internet address of the host
  268.  *    machType        The machine type.  This string value is used
  269.  *                when expanding $MACHINE in pathnames.
  270.  *    name              The official name for the machine
  271.  *    aliases              Other names for the machine
  272.  */
  273.  
  274. /*
  275.  * A Host_Entry contains the broken out fields of the host table line
  276.  * for a host.
  277.  *
  278.  * Sprite hosts may be connected to the network by different local-area-nets
  279.  * (LANs). The netType field of the Host_Entry tells what type of network
  280.  * it is. The Addr field in the netAddr union should be chosen based on
  281.  * this type.
  282.  *
  283.  */
  284. typedef enum {
  285.     HOST_ETHER,
  286.     HOST_INET
  287. } Host_NetType;
  288.  
  289. #define HOST_ETHER_ADDRESS_SIZE 6
  290.  
  291. typedef struct {
  292.     char              *name;      /* Primary name */
  293.     char              **aliases;  /* Other names */
  294.     int                  id;        /* Sprite ID */
  295.     struct in_addr    inetAddr;   /* Internet address */
  296.     Host_NetType      netType;    /* Network used to connect to host */
  297.     union {
  298.     unsigned char    etherAddr[HOST_ETHER_ADDRESS_SIZE];
  299.                     /* Ethernet address of machine or 
  300.                      * first gateway if netType is HOST_INET. */
  301.     }                  netAddr;    /* Address for that network */
  302.    char            *machType;  /* Machine type, i.e "sun3", "spur" */
  303. } Host_Entry;
  304.  
  305. /*
  306.  * Accessor functions
  307.  */
  308. Host_Entry *    Host_ByID();        /* Find host entry by Sprite ID */
  309. Host_Entry *    Host_ByInetAddr();    /* Find by Internet address */
  310. Host_Entry *    Host_ByName();        /* Find entry by name */
  311. Host_Entry *    Host_ByNetAddr();    /* Find by LAN address */
  312. void        Host_End();        /* Close host description file */
  313. Host_Entry *    Host_Next();        /* Retrieve next entry in file */
  314. int        Host_SetFile();        /* Change file to read for info */
  315. int        Host_Start();        /* Open host description file */
  316.  
  317. #endif /* NEW_HOST */
  318. @
  319.  
  320.  
  321. 1.7
  322. log
  323. @changed fields to handle multiple network interfaces for a single host
  324. @
  325. text
  326. @d17 1
  327. a17 1
  328.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.6 90/11/06 16:51:15 jhh Exp Locker: voelker $ SPRITE (Berkeley)"
  329. d32 1
  330. a32 1
  331. #ifdef NEW_NET
  332. d34 2
  333. d90 11
  334. a100 1
  335. #define HOST_NUM_NET_TYPES          3
  336. d109 4
  337. a112 12
  338. typedef struct Host_NetLink {
  339.     struct in_addr      inetAddr;   /* Internet Address */
  340.     Host_NetType        netType;    /* Type of network */
  341.     union {
  342.     unsigned char   etherAddr[HOST_ETHER_ADDRESS_SIZE];
  343.                                 /* Ethernet address of interface */
  344.     unsigned char   ultraAddr[HOST_ULTRA_ADDRESS_SIZE];
  345.                                 /* Ultranet address of interface */
  346.     unsigned char   fddiAddr[HOST_FDDI_ADDRESS_SIZE];
  347.                                 /* FDDI address of interface */
  348.     }                   netAddr;    /* Address of network interface */
  349. } Host_NetLink;
  350. d128 1
  351. a128 1
  352.    Host_NetLink         netLinks[HOST_NUM_NET_TYPES];
  353. d130 1
  354. a130 2
  355.                      * each possible network interface,
  356.                      * indexed by netType */
  357. d145 1
  358. a145 1
  359. #else /* NEW_NET */
  360. d208 1
  361. a208 1
  362. #endif /* NEW_NET */
  363. @
  364.  
  365.  
  366. 1.6
  367. log
  368. @includes stat.h
  369. @
  370. text
  371. @d17 1
  372. a17 1
  373.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.5 89/06/23 11:30:42 rab Exp $ SPRITE (Berkeley)"
  374. d31 113
  375. d204 2
  376. @
  377.  
  378.  
  379. 1.6.1.1
  380. log
  381. @Initial branch for Sprite server.
  382. @
  383. text
  384. @d17 1
  385. a17 1
  386.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.6 90/11/06 16:51:15 jhh Exp $ SPRITE (Berkeley)"
  387. @
  388.  
  389.  
  390. 1.5
  391. log
  392. @*** empty log message ***
  393. @
  394. text
  395. @d17 1
  396. a17 1
  397.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.4 89/06/05 14:27:31 mendel Exp Locker: rab $ SPRITE (Berkeley)"
  398. d30 1
  399. @
  400.  
  401.  
  402. 1.4
  403. log
  404. @Fixed comment.
  405. @
  406. text
  407. @d17 1
  408. a17 1
  409.  *    "$Header: /sprite/src/lib/include/RCS/host.h,v 1.2 88/07/02 16:41:25 ouster Exp Locker: mendel $ SPRITE (Berkeley)"
  410. d28 1
  411. a28 1
  412. #endif _IN
  413. d91 1
  414. a91 1
  415. #endif _HOST
  416. @
  417.  
  418.  
  419. 1.3
  420. log
  421. @Added HOST_INET type.
  422. @
  423. text
  424. @d73 2
  425. a74 1
  426.                     /* Ethernet address */
  427. @
  428.  
  429.  
  430. 1.2
  431. log
  432. @Make etherAddr unsigned:  easier to compare.
  433. @
  434. text
  435. @d17 1
  436. a17 1
  437.  *    "$Header: host.h,v 1.1 88/05/03 13:37:22 brent Exp $ SPRITE (Berkeley)"
  438. d38 2
  439. a39 2
  440.  *                      connected. Currently, only "ether" is
  441.  *                      understood.
  442. d59 2
  443. a60 1
  444.     HOST_ETHER
  445. @
  446.  
  447.  
  448. 1.1
  449. log
  450. @Initial revision
  451. @
  452. text
  453. @d1 1
  454. a1 1
  455. /*-
  456. d23 3
  457. d27 1
  458. a27 1
  459. #include    <netinet/in.h>
  460. d71 1
  461. a71 1
  462.     char        etherAddr[HOST_ETHER_ADDRESS_SIZE];
  463. @
  464.